import Vue from 'vue'
import App from './App'
import './assets/js/global'
import VueResource from 'vue-resource'
import infiniteScroll from 'vue-infinite-scroll';
Vue.use(infiniteScroll);
import 'assets/css/baseFy.scss'
import 'assets/css/global.scss'
Vue.use(VueResource);
import VueRouter from 'vue-router'
Vue.use(VueRouter);
import  { ToastPlugin } from 'vux'
Vue.use(ToastPlugin)
import jssdk from 'assets/js/jssdk/wxJSSDK'


import Home from 'components/home'
import Library from 'components/library'
//新闻通告
import NewsAnnouncement from 'components/news/newsAnnouncement'
import News from 'components/news/news'
import NewsDetail from 'components/news/newsDetail'
//安全绩效
import SPerformanceTeam from 'components/S_Performance/team'
import SPerformanceWeek from 'components/S_Performance/week'
import SPerformanceYear from 'components/S_Performance/year'
import YearLevelExplain from 'components/S_Performance/levelInfo'
import ZeroRanking from 'components/S_Performance/zeroRanking'
import YearPayDetail from 'components/S_Performance/payDetail'
import YearEarnsDetail from 'components/S_Performance/earnsDetail'
import RankingList from 'components/S_Performance/ranking'
import teamRankingList from 'components/S_Performance/teamRanking'
import TeamStatusDetail from 'components/S_Performance/statusDetail'
import TeamLevel from 'components/S_Performance/teamLevel'
import TeamLevelExplain from 'components/S_Performance/teamLevelInfo'
//安全绩效-违章/事故/扣分
import IllegalByWeek from 'components/S_Performance/illegalByWeek'
import IllegalByYear from 'components/S_Performance/illegalByYear'
import AccidentByYear from 'components/S_Performance/accidentByYear'
import DudectPointByYear from 'components/S_Performance/dudectPointByYear'
//审批
import ApprovalList from 'components/task/approvalList'
import ApprovalDetail from 'components/task/approvalDetail'

//安全圈
import SafetyLoop from 'components/safetyLoop/safetyLoopList'
import NmDetail from 'components/safetyLoop/NMDetail'
import SafeToGoDetail from 'components/safetyLoop/safetyToGoDetail'
import safetyMeetingDetail from 'components/safetyLoop/safetyMeetingDetail'
import SocDetail from 'components/safetyLoop/socDetail'
import Select from 'components/safetyLoop/select'

//事故alert
import AlertList from 'components/alert/alert'
import AlertDatail from 'components/alert/alertDetail'

import Profile from 'components/profiles/profile.vue'                     // 个人档案
import TrainingRecords from 'components/profiles/training_records.vue'    // 培训记录
import PatrolRecords from 'components/profiles/patrol_records.vue'        // 巡检记录
import IncidentRecords from 'components/profiles/incident_record.vue'     // 事故记录
import RewardRecords from 'components/profiles/reward_records.vue'        // 奖惩记录
import FeedbackList from 'components/profiles/feedbackList.vue'           // 意见反馈列表
import FeedbackForm from 'components/profiles/feedbackForm.vue'           // 意见反馈表单
import myCar from 'components/profiles/mycar.vue'                         // 我的车辆
import breakRulesRecords from 'components/profiles/break_rules_records.vue'     // 违章记录
import editeInfo from 'components/profiles/edite_info.vue'                // 编辑个人信息
//安全报告
import SafeMenu from 'components/safereport/SafeMenu'       // 安全报告九宫格
import SafeList from 'components/safereport/SafeList'       // 安全报告列表
import nmDetail from 'components/safereport/nmDetail'       // NM详情
import stgDetail from 'components/safereport/stgDetail'     // STG详情
import socDetail from 'components/safereport/socDetail'     // SOC详情
//import raDetail from 'components/safereport/raDetail'       // RA详情
import raDetail from 'components/safereport/newRaDetail'
import carCheck from 'components/safereport/carCheck'       // 季度车检
import safeMeeting from 'components/safereport/safeMeeting'    //安全会议
import userChoose from 'components/safereport/userList'  //选择用户列表
import vehicleIncidentList from 'components/safereport/vehicleIncidentList'  // 事故报告
import jra from 'components/safereport/jra'  // 事故报告



//活动报名
import EnrollmentList from 'components/enrollment/Enrollmentlist'
import EnrollmentDetail from 'components/enrollment/EnrollmentDetail.vue'

//任务列表
import Task from 'components/task/tasklist'
import freeTask from 'components/task/freeForm'   //雪地胎任务页面
import historyTask from 'components/task/historyTask'  //历史任务

import NoPormission from 'components/noPermission'//无权限page

const router = new VueRouter({
  mode: 'hash',
  base: __dirname,
  routes: [
    {path: '/', component: Home},
    {path: '/library', component: Library},
    {path: '/noPermission', component: NoPormission},

    {path: '/newsAnnouncement', component: NewsAnnouncement},
    {path: '/news', component: News},
    {path: '/newsdetail', component: NewsDetail},

    {path: '/safetyloop', component: SafetyLoop},
    {path: '/getNmDetail', component: NmDetail},
    {path: '/getSafeToGoDetail', component: SafeToGoDetail},
    {path: '/getsafetyMeetingDetail', component: safetyMeetingDetail},
    {path: '/getSocDetail', component: SocDetail},
    {path: '/select', component: Select},

    {path: '/getAlertList', component: AlertList},
    {path: '/getAlertDatail', component: AlertDatail},

    {path: '/profile', component: Profile},                             // 个人档案
    {path: '/trainingrecords', component: TrainingRecords},             // 培训记录
    {path: '/patrolrecords', component: PatrolRecords},                 // 巡检记录
    {path: '/incidentrecords', component: IncidentRecords},             // 事故记录
    {path: '/rewardrecords', component: RewardRecords},                 // 奖惩记录
    {path: '/feedbacklist', component: FeedbackList},                   // 意见反馈列表
    {path: '/feedbackform', component: FeedbackForm},                   // 意见反馈表单
    {path: '/mycar', component: myCar},                                 // 我的车辆
    {path: '/breakRulesRecords', component: breakRulesRecords},         // 违章记录
    {path: '/editeInfo', component: editeInfo},                         // 编辑个人信息

    {path: '/S_Performance-team', component: SPerformanceTeam},
    {path: '/S_Performance-week', component: SPerformanceWeek},
    {path: '/S_Performance-year', component: SPerformanceYear},
    {path: '/getLevelExplain', component: YearLevelExplain},
    {path: '/getPayDetail', component: YearPayDetail},
    {path: '/getEarnsDetail', component: YearEarnsDetail},
    {path: '/getZeroRankingList', component: ZeroRanking},
    {path: '/getRangkingList', component: RankingList},
    {path: '/getTeamRangkingList', component: teamRankingList},
    {path: '/getIllegalByWeek', component: IllegalByWeek},
    {path: '/getIllegalByYear', component: IllegalByYear},
    {path: '/getAccidentByYear', component: AccidentByYear},
    {path: '/getDudectPointByYear', component: DudectPointByYear},
    {path: '/getStatusDetail', component: TeamStatusDetail},
    {path: '/getTeamLevel', component: TeamLevel},
    {path: '/getTeamLevelExplain', component: TeamLevelExplain},

    {path: '/getApprovalList', component: ApprovalList},
    {path: '/getApprovalDetail', component: ApprovalDetail},

    {path: '/SafeMenu', component: SafeMenu},

    {path: '/SafeMenu/freeTask', component: freeTask},

    {path: '/SafeMenu/:id', component: SafeList},
    {path: '/SafeMenu/:id/NM', component: nmDetail},
    {path: '/SafeMenu/:id/STG', component: stgDetail},
    {path: '/SafeMenu/:id/SOC', component: socDetail},
    {path: '/SafeMenu/:id/RA', component: raDetail},
    {path: '/SafeMenu/:id/VEHICLE', component: carCheck},
    {path: '/SafeMenu/:id/SM', component: safeMeeting},
    {path: '/SafeMenu/:id/accident', component: vehicleIncidentList},
    {path: '/SafeMenu/:id/JRA', component: jra},

    {path: '/userList', component: userChoose},

    {path: '/task', component: Task},
    {path: '/historyTask', component: historyTask},
    {path: '/enrollmentlist', component: EnrollmentList},                // 活动列表
    {path: '/enrollmentdetail', component:EnrollmentDetail}               // 活动详情
  ]
});

router.beforeEach((to, from, next) => {
  window.scrollTo(0,0)//页面切换，重置滚动条位置
  next()
})


const app = new Vue({
  router,
  mixins:[jssdk],
  el: '#app',
  render: h => h(App),
  mounted() {
    this.init();
  }
})
